class Solution(object):
    def alphabetBoardPath(self, target):
        x = (0, 0)
        out = []
        for index, c in enumerate(target):
            c_a = ord(c) - ord('a')
            y = (c_a // 5, c_a % 5)
            if x == y:
                out.append('!')
            else:
                if x == (5, 0):
                    out.append('U')
                    x = (4, 0)
                if x[1] != y[1]:
                    if x[1] < y[1]:
                        out.append('R' * (y[1] - x[1]))
                    if x[1] > y[1]:
                        out.append('L' * (x[1] - y[1]))
                if x[0] != y[0]:
                    if x[0] < y[0]:
                        out.append('D' * (y[0] - x[0]))
                    if x[0] > y[0]:
                        out.append('U' * (x[0] - y[0]))
                out.append('!')
                x = y
        return ''.join(out)



data = Solution()
target = "leet"
print(data.alphabetBoardPath(target))
